<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Time</title>
</head>
<body>
<div id="time" style="text-align: center;font-size: 30px">Time</div>
</body>
<script>
    //获取标签对象
    let timeDiv = document.getElementById("time");

    //设置循环定时器
    setInterval("flushTime()", 1000);

    //刷新事件函数
    function flushTime() {
        let time = new Date();
        timeDiv.innerText = time.getFullYear() + " 年 "
            + (time.getMonth() + 1) + " 月 "
            + time.getDay() + " 日 \n"
            + time.getHours()+":"+ time.getMinutes()+":"+ time.getSeconds();
    }


</script>
</html>